FROM golang:alpine

ENV GOROOT /usr/local/go
ENV GOPROXY "https://goproxy.cn,direct"
ENV GOSUMDB "sum.golang.google.cn"

ENV DOCKER_HOME /usr/local/docker
ENV PATH $GOPATH/bin:$DOCKER_HOME:$GOROOT/bin:$PATH

ENV alpineMirror="https://mirrors.aliyun.com"
# ENV alpineMirror="https://mirrors.cloud.tencent.com"
# ENV alpineMirror="https://mirrors.tuna.tsinghua.edu.cn"
ENV majorVer=v3.15

RUN rm -f /etc/apk/repositories && echo "${alpineMirror}"/alpine/"${majorVer}"/main/ >> /etc/apk/repositories && echo "${alpineMirror}"/alpine/"${majorVer}"/community/  >> /etc/apk/repositories && echo "${alpineMirror}"/alpine/"${majorVer}"/community/ >> /etc/apk/repositories

ADD . /app

WORKDIR /app/main
RUN go build .

CMD nohup ./main && tail -f > /dev/null
